jsf <aj4>中outputmedia显示图片的问题
来源:百度知道 编辑:UC知道 时间:2024/07/02 02:31:32
请问下如何在a4j outputmedia中显示一个已经存在bufferedimage
谢谢
谢谢
<a4j:mediaOutput element="img" mimeType="image/jpeg"
createContent="#{fileUploadBean.paint}"
style="width:100px; height:100px;" cacheable="false">
</a4j:mediaOutput>
public void paint(OutputStream out,Object object)
{
try
{
//必须有网线
URL url = new URL("http://i1.sinaimg.cn/ty/s/2009-06-17/1245182714_oYaPWI.jpg");
URLConnection conn = url.openConnection();
Image image = ImageIO.read(conn.getInputStream());
System.out.println(image);
//InputStream is = new FileInputStream(this.fileAddress("苹果"));
//Image imag